import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

/**
 * Created by WEN on 2016/9/27.
 */
public class SingleNumberll {
    public int singleNumber(int[] nums){
        HashMap<Integer,Boolean> hm = new HashMap<Integer, Boolean>();
        Object key = null;
        for(int a:nums){
            if(hm.containsKey(a)) {
                hm.put(a,false);
            }else hm.put(a,true);
        }
        Set keys = hm.keySet();
        Iterator it = keys.iterator();
        while (it.hasNext()){
            key = it.next();
            if(hm.get(key)==true) break;
        }
        return (Integer)key;
    }
}
